package com.xinqi.xinqidev.publisher.consumer.listeners;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author xin麒
 * @date 2023/11/16 12:02
 */
@Slf4j
@Component
public class MqListener {

    @RabbitListener(queues = "xinqiDirect.queue1")
    public void listenWorkQueue1(String msg) throws InterruptedException {
        log.debug("消费者1 监听【xinqiFanout.queue1】队列，拿到消息：" + "【" + msg + "】");
    }

    @RabbitListener(queues = "xinqiDirect.queue2")
    public void listenWorkQueue2(String msg) throws InterruptedException {
        log.debug("消费者2 监听【xinqiFanout.queue2】队列，拿到消息：" + "【" + msg + "】");
    }

/**
 * 11-19 17:11:58:249 DEBUG 7796 --- [ntContainer#0-1] c.x.x.p.consumer.listeners.MqListener    : 消费者1 监听【xinqiFanout.queue1】队列，拿到消息：【2023-11-19 12:00 红色警报！日本乱排核废水，导致海洋生物变异，惊现哥斯拉！】
 * 11-19 17:11:58:249 DEBUG 7796 --- [ntContainer#1-1] c.x.x.p.consumer.listeners.MqListener    : 消费者2 监听【xinqiFanout.queue2】队列，拿到消息：【2023-11-19 12:00 红色警报！日本乱排核废水，导致海洋生物变异，惊现哥斯拉！】
 * 11-19 17:11:58:249 DEBUG 7796 --- [ntContainer#1-1] c.x.x.p.consumer.listeners.MqListener    : 消费者2 监听【xinqiFanout.queue2】队列，拿到消息：【2023-11-19 9:00 黄色预警，巨型不明物体初现】
 * 11-19 17:11:58:249 DEBUG 7796 --- [ntContainer#0-1] c.x.x.p.consumer.listeners.MqListener    : 消费者1 监听【xinqiFanout.queue1】队列，拿到消息：【2023-11-19 16:00  最新报道，哥斯拉是居民自治巨型气球，虚惊一场！】
 */
}
